<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 * @remark 本模块并未在系统中调用，后续会考虑添加本功能
 */
    session_start();
    include("top.php");
?>
<table width="766" height="438" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="209" height="438" valign="top" bgcolor="#F5F5F5"><?php include("left.php");?></td>
    <td width="557" align="center" valign="top" bgcolor="#FFFFFF"><table width="550" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="50">&nbsp;</td>
      </tr>
    </table>
      <table width="550" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td></td>
        </tr>
      </table>
      <table width="550" height="70" border="0" align="center" cellpadding="0" cellspacing="0">
        <?php
        /**
         * @todo 增加分页功能
         */
                 $sql= exectue_sql_statement($conn, "select top 3 Orders.book_id, book_name, book_introduction, unit_price, book_img, book_amount from Book, Orders, Store where Book.book_id=Orders.book_id and Book.book_id=Store.book_id group by Orders.book_id, book_name, book_introduction, unit_price, book_img, book_amount order by sum(orders_amount) desc");
		 $info=sqlsrv_fetch_array($sql);
		 if($info==false){
		   echo "本站暂无最热图书!";
		  } 
		 else{ 
		    do{ 
	   ?>
          <table>
        <tr>
          <td width="89"  rowspan="6"><div align="center">
              <?php
			 if($info['book_img']==""){
			   echo "暂无图片!";
			 }
			 else{
			?>
              <a href="bookinfo.php?book_id=<?php echo $info['book_id'];?>"><img border="0" src="<?php echo $info['book_img'];?>" width="80" height="80"></a>
              <?php
			 }
			?>
          </div></td>
          <td width="92" height="20" align="left" bgcolor="#FFFFFF"><div align="center">图书名称：</div></td>
                  <td width="134" bgcolor="#FFFFFF"><div align="left">&nbsp;<?php echo $info['book_name'];?></div></td>
        </tr>
        <tr>
          <td height="20" align="left" bgcolor="#FFFFFF"><div align="center">售价：</div></td>
          <td width="134" bgcolor="#FFFFFF"><div align="left">&nbsp;<?php echo $info['unit_price'];?></div></td>
        </tr>
        <tr>
           <td width="100" bgcolor="#FFFFFF"><div align="center">数量：</div></td>
           <td width="129" bgcolor="#FFFFFF"><div align="left">&nbsp;<?php echo $info['book_amount'];?></div></td>
        </tr>
        <tr>
          <td><div align="center"><a href="addtocart.php?book_id=<?php echo $info['book_id'];?>"><input type="button" value="放入购物车"></a>&nbsp;&nbsp;</div></td>
        </tr>
        </table>
        <!--
        <tr>
          <td width="93" height="20"><div align="center" style="color: #000000">商品简介：</div></td>
          <td height="20" colspan="5"><div align="left"><?php echo $info[jianjie];?></div></td>
        </tr>
        -->
        <?php
	    	}while($info=sqlsrv_fetch_array($sql));
		 }
		?>
      </table></td>
  </tr>
</table>
<?php
 include("bottom.php");
?>